#include <stdio.h>
#define ASIZE 100

int
main ()
{
	int n, a, b, arr[ASIZE], k;
	int tmp, i=0, j=0;

	freopen("rotate.in", "r", stdin);
	freopen("rotate.out", "w", stdout);

	scanf("%d", &n);
	while (i < n)
		scanf("%d", &arr[i++]);

	scanf("%d", &k);
	while (j++ < k) {
		scanf("%d%d", &a, &b);
		//fprintf(stderr, "\t\t%d\n", (b-a)/2 -a+1);
		for (i = 0; i < ((b + a)/2 - a+1) ; ++i) {
			tmp = arr[a+i];
			arr[a+i] = arr[b-i];
			arr[b-i] = tmp;
			//fprintf(stderr, "\t%d:%d -- %d <-> %d\n", a, b, arr[b-i], arr[a+i]);
		}
		//++j;
	}

	for (i = 0; i < n; ++i)
		printf("%d ", arr[i]);
	printf("\n");
	return 0;
}
